<template>
  <div id="cart">
    <nav-bar class="home-nav">
      <div slot="center">购物车({{ Length }})</div>
    </nav-bar>
    <scroll class="content" :probeType="2" :pull-up-load="true" ref="scroll">
      <cart-list></cart-list>
    </scroll>
    <cart-buttom-bar></cart-buttom-bar>
  </div>
</template>

<script>
import NavBar from "components/common/navbar/NavBar";
import CartList from "views/cart/childComps/CartList";
import Scroll from "components/common/scroll/scroll";
import CartButtomBar from "views/cart/childComps/CartButtomBar";
import { mapGetters } from "vuex";
export default {
  name: "Cart",
  data() {
    return {};
  },
  computed: {
    // cartLength() { 此函数作用和...mapGetters一样
    //   return this.$store.getters.cartLength
    // },
    // ...mapGetters(['cartLength'])
    ...mapGetters({ Length: "cartLength" }),
  },
  activated() {
    this.$refs.scroll.refresh();
  },
  components: {
    NavBar,
    CartList,
    CartButtomBar,
    Scroll,
  },
};
</script>

<style  scoped>
.cart {
  height: 100vh;
  background-color: white;
}
.home-nav {
  background-color: rgb(255, 129, 152);
  color: white;
}
.content {
  overflow: hidden;
  position: absolute;
  top: 44px;
  bottom: 89px;
  left: 0;
  right: 0;
}
</style>

